const http = require('http')

http.createServer((req, res) => {
    // console.log(req.url)
    res.setHeader('Access-Control-Allow-Origin', '*')
    res.setHeader('Access-Control-Allow-Methods', '*')
    if(req.url == "/login") {
        var user = {
            name: "张三",
            sex: "男",
            age: 15,
            id: 1212112,
            accound: 'assbdd',
            psw: 123456
        }
        user = JSON.stringify(user)
        console.log(user)
        // res.end('fn(' + user + ')')
        res.end(user)
    } else {
        res.end('error')
    }
   
}).listen(3000, () => {
    console.log('serve is running')
})